<template>
	<view style="position: fixed;bottom: 0;left: 0;width: 100%;background: #fff;padding-bottom:10rpx;">
		<u-tabbar
			:value="value5"
			@change="change5"
			:fixed="false"
			:placeholder="false"
			:safeAreaInsetBottom="false"
		>
			<u-tabbar-item v-for="item in menus" :key="item.nanm" :text="item.text">
				<image
					class="u-page__item__slot-icon"
					slot="active-icon"
					:src="item.selectedIconPath"
				></image>
				<image
					class="u-page__item__slot-icon"
					slot="inactive-icon"
					:src="item.iconPath"
				></image>
			</u-tabbar-item>
			<!-- <u-tabbar-item text="放映厅" icon="photo" ></u-tabbar-item>
			<u-tabbar-item text="直播" icon="play-right" ></u-tabbar-item>
			<u-tabbar-item text="我的" icon="account" ></u-tabbar-item> -->
		</u-tabbar>
	</view>
</template>

<script>
import { userInfo } from '../../apis/modules/user';
	export default {
		name:"tabbar",
		data() {
			return {
				value5:0,
				menus:[]
			};
		},
		mounted() {
			console.log(99999,this.userInfo.group_id);
			
			if(this.userInfo.group_id == 1 || this.userInfo.group_id == 2){
				this.menus = [{
								"pagePath": "pages/index/index",
								"iconPath": "/static/imgs/home.png",
								"selectedIconPath": "/static/imgs/home_active.png",
								"text": "首页"
							}, {
								"pagePath": "pages/task/task",
								"iconPath": "/static/imgs/task.png",
								"selectedIconPath": "/static/imgs/task_active.png",
								"text": "每日任务"
							}, {
								"pagePath": "pages/baojin/list",
								"iconPath": "/static/imgs/alarm.png",
								"selectedIconPath": "/static/imgs/alarm_active.png",
								"text": "报警列表"
							}, {
								"pagePath": "pages/notify/list",
								"iconPath": "/static/imgs/notice.png",
								"selectedIconPath": "/static/imgs/notice_active.png",
								"text": "通知列表"
							}]
			}else{
				this.menus = [{
								"pagePath": "pages/index/index",
								"iconPath": "/static/imgs/home.png",
								"selectedIconPath": "/static/imgs/home_active.png",
								"text": "首页"
							},  {
								"pagePath": "pages/notify/list",
								"iconPath": "/static/imgs/notice.png",
								"selectedIconPath": "/static/imgs/notice_active.png",
								"text": "通知列表"
							}]
			}
			this.value5 = uni.getStorageSync('tabbarIndex')
		},
		methods:{
			change5(name) {
				console.log({name});
				this.value5 = name
				uni.setStorageSync('tabbarIndex', name)
				uni.redirectTo({
					 url: '/' + this.menus[name]['pagePath']
				});
			},
		}
	}
</script>

<style scoped>
	.u-page__item__slot-icon{
		width: 50rpx;
		height: 50rpx;
	}

</style>